import { createBrowserRouter, Navigate } from 'react-router-dom';
import MainLayout from '../layouts/MainLayout';
import Login from '../pages/Login';
import Dashboard from '../pages/Dashboard';
import VaccineList from '../pages/Vaccine/List';
import AppointmentCreate from '../pages/Appointment/Create';
import AppointmentHistory from '../pages/Appointment/History';
import UserProfile from '../pages/User/Profile';

export const router = createBrowserRouter([
  {
    path: '/login',
    element: <Login />,
  },
  {
    path: '/',
    element: <MainLayout />,
    children: [
      {
        index: true,
        element: <Navigate to="/dashboard" replace />,
      },
      {
        path: 'dashboard',
        element: <Dashboard />,
      },
      {
        path: 'vaccine/list',
        element: <VaccineList />,
      },
      {
        path: 'appointment/create',
        element: <AppointmentCreate />,
      },
      {
        path: 'appointment/history',
        element: <AppointmentHistory />,
      },
      {
        path: 'user/profile',
        element: <UserProfile />,
      },
    ],
  },
]);
